package com.system.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @Classname ListUtils
 * @Description TODO
 * @Date 2023/9/27 0:07
 * @Created by XiongXiong
 * @Author: X.I.O
 */
public class ListUtils {

    public static String[] getStringArrays(List<String> strings){
        String[] stringArray=new String[strings.size()];
        strings.toArray(stringArray);
        return stringArray;
    }

    /**
     * 合并两个list
     * @param strings_1
     * @param strings_2
     * @return
     */
    public static List<String> mergeTwoList(List<String> strings_1,List<String> strings_2){
        int size=(strings_1.size()+strings_2.size());
        List<String> strings=new ArrayList<>(size);
        strings.addAll(strings_1);
        strings.addAll(strings_2);
        return strings;
    }

    public static List<String> formartList(String[] strings){
        List<String> strings1=new ArrayList<>(strings.length);
        for (int i = 0; i < strings.length ; i++) {
            String s=strings[i];
            strings1.add(s);
        }
        strings=null;
        return strings1;
    }
}
